package com.mistyrain.service.impl;

import com.mistyrain.entity.User;
import com.mistyrain.entity.UserVO;
import com.mistyrain.feign.OrderFeign;
import com.mistyrain.feign.UserFeign;
import com.mistyrain.service.UserService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

@Service
public class UserServiceImpl implements UserService {
    @Autowired
    private UserFeign userFeign;
    @Autowired
    private OrderFeign orderFeign;
    @Override
    public UserVO findAll(int page, int limit) {
        return userFeign.findAll(page, limit);
    }

    @Override
    public String save(User user) {
        userFeign.save(user);
        return "redirect:/account/redirect/user_manage";
    }

    @Override
    public String deleteById(long id) {
        orderFeign.deleteByUid(id);
        userFeign.deleteById(id);
        return "redirect:/account/redirect/user_manage";
    }
}
